package Car;

import java.util.Iterator;
import org.eclipse.emf.common.util.EList;
import turtle.*;;

public class SimpleToHTML
{
  protected static String nl;
  public static synchronized SimpleToHTML create(String lineSeparator)
  {
    nl = lineSeparator;
    SimpleToHTML result = new SimpleToHTML();
    nl = null;
    return result;
  }

  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">" + NL + "<html>" + NL + "<head> <title> Stage Description</title>" + NL + "<meta name=\"language\" content=\"en\">" + NL + "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">" + NL + "</head>" + NL + "<body>" + NL + "<h1> List of Stage's Choreographies</h2>" + NL + " ";
  protected final String TEXT_2 = NL + "\t\t\t<h3>" + NL + "\t\t\t";
  protected final String TEXT_3 = NL + "\t\t\t</h3></br>" + NL + "\t\t\t" + NL + "\t\t" + NL + "\t" + NL + "\t\t";
  protected final String TEXT_4 = NL + "\t\t<h3>Fin.</h3>" + NL + "\t\t" + NL + "\t\t";
  protected final String TEXT_5 = NL + "</body>" + NL + "</html>";

  public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
     Stage stage = (Stage) argument; 
    stringBuffer.append(TEXT_1);
    EList<Choregraphy> listChoreography = stage.getChrs();
	for(Choregraphy c: listChoreography){
			EList<Action> actions=  c.getActions();
			
			for(Action a: actions){
			
    stringBuffer.append(TEXT_2);
    stringBuffer.append( a.toString() );
    stringBuffer.append(TEXT_3);
    }
    stringBuffer.append(TEXT_4);
     }

    stringBuffer.append(TEXT_5);
    return stringBuffer.toString();
  }
}
